﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FisheryPlatform.Entity;
using FisheryPlatform.DataAccess.Product;

namespace FisheryPlatform.Bussiness.Product
{
    public class ProductManager
    {
        public static bool Save(ProductEntity proInfo)
        {
            return ProductDB.Save(proInfo);
        }

        public static List<ProductEntity> Search(string sqlWhere, int pageIndex, int pageSize, out int pageCount)
        {
            return ProductDB.Search(sqlWhere, pageIndex, pageSize, out pageCount);
        }

        public static ProductEntity Get(long productId)
        {
            return ProductDB.GetByProductId(productId);
        }

        public static bool UpdateStatus(long productId, ProductStatusEnum status)
        {
            return ProductDB.UpdateStatus(productId, status);
        }

        public static string GetProductStatusText(ProductStatusEnum status)
        {
            #region
            var result = "";
            switch (status)
            {
                case ProductStatusEnum.Draft: result = "草稿"; break;
                case ProductStatusEnum.Publishing: result = "发布中"; break;
                case ProductStatusEnum.Pausing: result = "暂停"; break;
                case ProductStatusEnum.Deleted: result = "删除"; break;
            }
            return result;
            #endregion
        }
    }
}
